<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="./../template/main.xhtml">
        <ui:define name="content">
            <h:form>
                <p:panel styleClass="FORM_HEADER_NEW">
                    <h:outputText value="City List" styleClass="FORM_HEADER_NEW"/>    
                </p:panel>  
                <br></br>
                <p:dataTable id="cityTable" value="${cityController.cityList}" 
                             var="city"
                             paginator="true" 
                             paginatorAlwaysVisible="false" 
                             paginatorPosition="bottom"
                             rowStyleClass="SIMPLE_LINE">
                    <p:column>
                        <f:facet name="header">Id</f:facet>
                        <h:outputText value="#{city.id}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Name</f:facet>
                        <h:outputText value="#{city.name}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Country</f:facet>
                        <h:outputText value="#{city.country.name}" styleClass="COLUMN"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Action</f:facet>
                        <h:commandLink value="View" action="#{cityController.view}">
                            <f:param name="cityId" value="#{city.id}"/>
                        </h:commandLink>
                        <h:outputText value=" "/>
                        <h:commandLink value="Edit" action="#{cityController.edit}">
                            <f:param name="cityId" value="#{city.id}"/>
                        </h:commandLink>
                    </p:column>
                </p:dataTable>
            </h:form>
        </ui:define>
    </ui:composition>
</html>